package top.jolyoulu.webcommon.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import top.jolyoulu.corecommon.cache.def.DefaultCacheBootStrap;
import top.jolyoulu.corecommon.cache.def.DefaultCacheEvictPolicy;
import top.jolyoulu.corecommon.cache.def.DefaultCacheOperator;
import top.jolyoulu.corecommon.queue.delayed.DelayedTaskBootStrap;
import top.jolyoulu.corecommon.queue.delayed.DelayedTaskProducer;
import top.jolyoulu.corecommon.queue.delayed.observer.DelayedTaskSubject;

/**
 * @Author: JolyouLu
 * @Date: 2023/4/15 21:10
 * 内置的缓存操作配置
 */
@Configuration
public class DefaultCacheConfig {

    @Bean
    public DefaultCacheOperator defaultCacheOperator(){
        return new DefaultCacheOperator(100);
    }

    @Bean
    public DefaultCacheBootStrap delayedTaskConsumer(DefaultCacheOperator defaultCacheOperator){
        return new DefaultCacheBootStrap(defaultCacheOperator,new DefaultCacheEvictPolicy());
    }

}
